package com.atguigu.srb.mybatiasPlus.controller;

import com.atguigu.srb.mybatiasPlus.entity.User;
import com.atguigu.srb.mybatiasPlus.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("user")
@RestController
@CrossOrigin
public class UserController {
    // 自动注入service
    @Autowired
    UserService userService;

    // get请求地址userList,返回值是List<User>
    @RequestMapping("userList")
    public List<User> userList(){
        return userService.list();
    }
}
